clear
set more off


cap log close

***Replace the below with location of your files

global maindir "C:\Users\emily.weber\Dropbox\intgmob_AssortativeMating\ReplicationPackage\"


***Create references to the sub directories
global tempdir "$maindir\intermediatedata\"
global outputdir "$maindir\output\"

global rawdir "$maindir\rawdata\census_1pct\"
global altdir "$maindir\rawdata\alt_wages\"
global histdir "$maindir\rawdata\icpsr\"
global ipumsdir "$maindir\rawdata\census_1pct\"
global ipums100dir "$maindir\rawdata\census_100pct\"



global incvars "score lido 1900 PHall PHnof"
global wealthvars "padj radj rfadj r50adj r60adj"


*Year and variable lists to run analysis WITHOUT 1940


*IF YOU HAVE 1940 DATA IN THE CENSUS FOLDER, COMMENT OUT THE FOLLOWING LINES OF CODE


global endyear 1930

global earlyyearlist "1850 1860 1870 1880 1900"
global yearlist "1880 1900 1910 1930"
global yearlistshort "1900 1910 1930"
global varlist1 "q4_1880 q4_1900 q4_1910 q4_1930 q3_1880 q3_1900 q3_1910 q3_1930 q2_1880 q2_1900 q2_1910 q2_1930 y1900 y1910 y1930 "
global varlist2 "q4 q4_1900 q4_1910 q4_1930 q3 q3_1900 q3_1910 q3_1930 q2 q2_1900 q2_1910 q2_1930 y1900 y1910 y1930 " 

global svcyearlist "1880  1910 1930"
global svcyearlistshort " 1910 1930"
global svcvarlist1 "q4_1880  q4_1910 q4_1930 q3_1880  q3_1910 q3_1930 q2_1880  q2_1910 q2_1930  y1910 y1930 "
global svcvarlist2 "q4 q4_1910 q4_1930 q3  q3_1910 q3_1930  q2  q2_1910 q2_1930  y1910 y1930 " 

global yearlistcomb "1900 1910"
global varlistcomb "q4_1900 q4_1910 q3_1900 q3_1910 q2_1900 q2_1910 y1900 y1910"

global qs4 $yearlist
global qs6 q6_1880 q6_1900 q6_1910 q6_1930 q5_1880 q5_1900 q5_1910 q5_1930 $qs4
global qs8 q8_1880 q8_1900 q8_1910 q8_1930 q7_1880 q7_1900 q7_1910 q7_1930 $qs6
global qs10 q10_1880 q10_1900 q10_1910 q10_1930 q9_1880 q9_1900 q9_1910 q9_1930 $qs8 


*Year and variable lists to run analysis WITH 1940

*IF YOU HAVE 1940 DATA IN THE CENSUS FOLDER, UNCOMMENT THE FOLLOWING LINES OF CODE

/*
global endyear 1940
global earlyyearlist "1850 1860 1870 1880 1900 1910"
global yearlist "1880 1900 1910 1930 1940"
global yearlistshort "1900 1910 1930 1940"
global varlist1 "q4_1880 q4_1900 q4_1910 q4_1930 q4_1940 q3_1880 q3_1900 q3_1910 q3_1930 q3_1940 q2_1880 q2_1900 q2_1910 q2_1930 q2_1940 y1900 y1910 y1930 y1940"
global varlist2 "q4 q4_1900 q4_1910 q4_1930 q4_1940 q3 q3_1900 q3_1910 q3_1930 q3_1940 q2 q2_1900 q2_1910 q2_1930 q2_1940 y1900 y1910 y1930 y1940"

global svcyearlist "1880  1910 1930 1940"
global svcyearlistshort " 1910 1930 1940"
global svcvarlist1 "q4_1880  q4_1910 q4_1930 q4_1940 q3_1880  q3_1910 q3_1930 q3_1940 q2_1880  q2_1910 q2_1930  q2_1940 y1910 y1930 y1940 "
global svcvarlist2 "q4 q4_1910 q4_1930 q4_1940 q3  q3_1910 q3_1930 q3_1940 q2  q2_1910 q2_1930 q2_1940 y1910 y1930 y1940" 

global yearlistcomb "1900 1910 1940"
global varlistcomb "q4_1900 q4_1910 q4_1940 q3_1900 q3_1910 q3_1940 q2_1900 q2_1910 q2_1940 y1900 y1910 y1940"

global qs4 $varlist1
global qs6 q6_1880 q6_1900 q6_1910 q6_1930 q6_1940 q5_1880 q5_1900 q5_1910 q5_1930 q5_1940 $qs4
global qs8 q8_1880 q8_1900 q8_1910 q8_1930 q8_1940 q7_1880 q7_1900 q7_1910 q7_1930 q7_1940 $qs6
global qs10 q10_1880 q10_1900 q10_1910 q10_1930 q10_1940 q9_1880 q9_1900 q9_1910 q9_1930 q9_1940 $qs8 
*/

***Run the Stata Code

*This set of codes prepares some intermediate datasets from the raw census and historical data.

do $maindir\dofiles\01-clean_data\01-calculate_farm_income.do
do $maindir\dofiles\01-clean_data\02-create_occ_wealth.do
do $maindir\dofiles\01-clean_data\03-gender_miscodes.do
do $maindir\dofiles\01-clean_data\04-clean_fathers.do
do $maindir\dofiles\01-clean_data\05-generate_trends_income.do
do $maindir\dofiles\01-clean_data\06-generate_trends_wealth.do
do $maindir\dofiles\01-clean_data\07-generate_trends_income_sdx.do
do $maindir\dofiles\01-clean_data\08-generate_trends_income_exage.do
do $maindir\dofiles\01-clean_data\09-create_control_panel.do
*File 10 will run within file 9
do $maindir\dofiles\01-clean_data\11-individual_reg_data.do
do $maindir\dofiles\01-clean_data\12-individual_reg_data_sdx.do

*This set of codes creates the figures and tables for the main paper and all appendicies except appendix A

do $maindir\dofiles\02-analysis\01-fig1a_figB1a.do
do $maindir\dofiles\02-analysis\02-fig1b_figB1b.do
do $maindir\dofiles\02-analysis\03-fig2.do
do $maindir\dofiles\02-analysis\04-fig3_fig4.do
do $maindir\dofiles\02-analysis\05-fig5_tabD1.do
do $maindir\dofiles\02-analysis\06-tabC1.do
do $maindir\dofiles\02-analysis\07-tabC2.do
do $maindir\dofiles\02-analysis\08-tabC3.do
do $maindir\dofiles\02-analysis\09-tabC4a.do
do $maindir\dofiles\02-analysis\10-tabC4b.do
do $maindir\dofiles\02-analysis\11-tabC4c.do
do $maindir\dofiles\02-analysis\12-tabC5.do
do $maindir\dofiles\02-analysis\13-tabC6.do
do $maindir\dofiles\02-analysis\14-tabC7.do
do $maindir\dofiles\02-analysis\15-figC1.do
do $maindir\dofiles\02-analysis\16-figE1_figE2.do


